# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=gnome-music
pkgver=40.1.1
pkgrel=1
epoch=1
pkgdesc="Music player and management application"
url="https://wiki.gnome.org/Apps/Music"
arch=(x86_64)
license=(GPL)
depends=(grilo grilo-plugins tracker3-miners libdmapsharing libmediaart gtk3
         gvfs python-gobject python-cairo gst-plugins-base python-requests
         libdazzle)
makedepends=(gobject-introspection git meson yelp-tools appstream-glib)
optdepends=('gst-plugins-good: Extra media codecs'
            'gst-plugins-ugly: Extra media codecs'
            'gst-plugins-bad: Extra media codecs'
            'gst-libav: Extra media codecs')
groups=(gnome)
_commit=be5141567a4bd73b8e955a98b5040cf5a482688e  # tags/40.1.1^0
source=("git+https://gitlab.gnome.org/GNOME/gnome-music.git#commit=$_commit"
        "git+https://gitlab.gnome.org/GNOME/libgd.git"
        "git+https://gitlab.gnome.org/mschraal/gfm.git")
sha256sums=('SKIP'
            'SKIP'
            'SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname

  git submodule init
  git submodule set-url subprojects/libgd "$srcdir/libgd"
  git submodule set-url subprojects/gfm "$srcdir/gfm"
  git submodule update
}

build() {
  arch-meson $pkgname build
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir="$pkgdir"

  python -m compileall -d /usr/lib "$pkgdir/usr/lib"
  python -O -m compileall -d /usr/lib "$pkgdir/usr/lib"
}
